package com.ssy.lingxi.purchase.api.enums.tender;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 * 投标外部状态枚举类型
 * @author jw.chen
 * @version 2.0.0
 * @date 2020/6/29
 */
public enum SubmitTenderOutStatusEnum {

    Not_Invite_Tender_Register(1, "待招标报名"),
    Not_Check_Register_Check(2, "待审核报名"),
    Register_Check_Not_Pass(3, "报名审核不通过"),
    Not_Submitted_Qualifications_Check(4, "待提交资格预审"),
    Not_Qualifications_Check(5, "待资格预审"),
    Qualifications_Check_Not_Pass(6, "资格预审不通过"),
    Not_Submit_Tender(7, "待投标"),
    Not_Open_Tender(8, "待开标"),
    Not_Selection_Tender(9, "待评标"),
    Not_Finish_Notice(10, "待定标"),
    Not_Win_Notice(11, "待中标公示"),
    Finish_Invite_Tender(12, "完成招标"),
    Discard_Tender(13, "已废标");

    private Integer code;
    private String message;

    SubmitTenderOutStatusEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return LanguageHolder.getName(this.getClass(), this.code);
    }

    public static String getMessage(Integer code){
        SubmitTenderOutStatusEnum statusEnum = Arrays.stream(SubmitTenderOutStatusEnum.values()).filter(v -> v.getCode().equals(code)).findAny().orElse(null);
        return null == statusEnum ? "" : LanguageHolder.getName(SubmitTenderOutStatusEnum.class, statusEnum.getCode());
    }
}
